package com.yanqu.road.server.cmd.group.rank;

import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.grandchild.GrandChildProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = CrossProtocol.C_GET_GRAND_CHILD_RANK_DETAIL_INFO, desc = "获取孙子榜单孙子详细信息")
public class CrossGrandChildRankDetailInfoCmd extends CrossCommand {
    GrandChildProto.GrandChildRankDetailInfoReqMsg reqMsg;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        reqMsg = GrandChildProto.GrandChildRankDetailInfoReqMsg.parseFrom(packet.getBytes());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        GrandChildProto.GrandChildRankDetailInfoCrossReqMsg.Builder crossReqMsg = GrandChildProto.GrandChildRankDetailInfoCrossReqMsg.newBuilder();
        crossReqMsg.setFromServerId(serverId);
        crossReqMsg.setFromUserId(packet.getPlayerId());
        crossReqMsg.setQueryUserId(reqMsg.getUserId());
        crossReqMsg.setId(reqMsg.getId());
        YanQuMessage message = YanQuMessageUtils.buildMessage(GameProtocol.S_GET_GRAND_CHILD_RANK_DETAIL_INFO_FROM_CROSS, crossReqMsg);
        MessageHelper.sendPacket(reqMsg.getServerId(), 0, message);
    }

    @Override
    public void sendData() {

    }
}
